<?php

App::uses('AppController', 'Controller');

class NovostiController extends AppController {
	
	public $uses = array('News', 'Headphoto');
	
	public $paginate = array(
		'News' => array(
			'limit' => 9
		)
	);
	
	public function index($page = 1) {
		$news = $this->paginate('News');
		if($photo = $this->Headphoto->find("first", array("conditions"=>array("entity"=>"Novosti","entity_id"=>"")))) {
			$this->top_photo = $photo['Headphoto']['image'];
		}
		$this->set("news",$news);
	}
	
	public function vest($id, $title) {
		$this->breadcrumbsAdd("Novosti", "/novosti");
		if($photo = $this->Headphoto->find("first", array("conditions"=>array("entity"=>"Novosti","entity_id"=>$id)))) {
			$this->top_photo = $photo['Headphoto']['image'];
		}
		$this->set("news", $this->News->findById($id));
	}
}
